<%@ taglib uri="webwork" prefix="webwork" %>
<%@ taglib uri="webwork" prefix="ui" %>
<%@ taglib uri="sitemesh-page" prefix="page" %>

<%@ page import="com.atlassian.jira.util.EasyList"%>
<%@ page import="com.atlassian.jira.web.action.util.JiraLicenseUtils"%>
<%@ page import="com.atlassian.license.License"%>
<%@ page import="com.atlassian.license.LicenseManager"%>

<html>
<head>
	<title><webwork:text name="'portal.configure'"/></title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
    <td width="200" bgcolor="#f0f0f0" valign="top">
        <jsp:include page="/includes/panels/user_summary_pane.jsp" />
    </td>

    <td bgcolor="#ffffff" valign="top">
        <table width=100% cellpadding="10" cellspacing="0" border="0">
        <tr><td>
            <page:applyDecorator name="jirapanel">
                <page:param name="title"><webwork:text name="'portal.configure'"/></page:param>
                <page:param name="width">100%</page:param>
                <page:param name="helpURL">configure_portal_pages</page:param>
                <p>
                    <webwork:text name="'configureportalpages.description.line1'"/><br/>
                    <webwork:text name="'configureportalpages.description.line2'">
                        <webwork:param name="'value0'"><span class="warning"></webwork:param>
                        <webwork:param name="'value1'"></span></webwork:param>
                    </webwork:text>
                </p>
                <p>
                    <img src="<webwork:url page="/images/icons/bullet_creme.gif"/>" height="8" width="8" border="0" alt="">&nbsp;<a href="<webwork:url page="RestoreDefaultDashboard!default.jspa"><webwork:param name="'destination'" value="'manageportal'"/></webwork:url>"><webwork:text name="'restoredefaultdashboard.restoredefaults'"/></a>
                </p>
            </page:applyDecorator>

            <webwork:if test="/currentPortalPage/default == false">
            <br/>

            <table align="center" bgcolor="#bbbbbb" border="0" cellpadding="0" cellspacing="0" width="90%">
            <tr><td>
                <table border="0" cellpadding="3" cellspacing="1" width=100%>
                <tr bgcolor="#f0f0f0">
                    <td class="colHeaderLink">
                        <b><webwork:text name="'common.words.name'" /></b>
                    </td>
                    <td>&nbsp;</td>
                    <td class="colHeaderLink">
                        <b><webwork:text name="'common.words.operations'" /></b>
                    </td>
                </tr>

                <webwork:iterator value="/dashboardPages" status="'status'">
                <tr bgcolor="#<webwork:if test="@status/modulus(2) == 1">ffffff</webwork:if><webwork:else>fffff0</webwork:else>">
                    <td valign="top">
                        <b><a href="<%= request.getContextPath() %>/secure/Dashboard.jspa?selectPageId=<webwork:property value="./id"/>"><webwork:property value="/pageName(.)" /></a></b>
                        <webwork:if test="/currentPortalPage == .">
                            <span class="smallgrey"><webwork:text name="'configureportalpages.currentpage'"/></span>
                        </webwork:if>
                        <webwork:if test="description && description/length > 0">
                            <br/>
                            <webwork:property value="description"/>
                        </webwork:if>
                    </td>
                    <td width="1%" nowrap>
                        <webwork:if test="@status/first == false">
                        <a id="pos_first_<webwork:property value="@status/index" />" href="ConfigurePortalPages!moveToStart.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/first.gif"  class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.first'"/>" alt="<webwork:text name="'configureportalpages.movepage.first'"/>"></a>
                        <a id="pos_up_<webwork:property value="@status/index" />" href="ConfigurePortalPages!moveUp.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/up.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.up'"/>" alt="<webwork:text name="'configureportalpages.movepage.up'"/>"></a></webwork:if>
                        <webwork:else><img src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow" alt=""><img src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow" alt=""></webwork:else>
                        <webwork:if test="@status/last != true">
                        <a id="pos_down_<webwork:property value="@status/index" />" href="ConfigurePortalPages!moveDown.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/down.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.down'"/>" alt="<webwork:text name="'configureportalpages.movepage.down'"/>"></a>
                        <a id="pos_last_<webwork:property value="@status/index" />" href="ConfigurePortalPages!moveToEnd.jspa?position=<webwork:url value="@status/index"/>"><img src="<%= request.getContextPath() %>/images/icons/last.gif" class="sortArrow" title="<webwork:text name="'configureportalpages.movepage.last'"/>" alt="<webwork:text name="'configureportalpages.movepage.last'"/>"></a></webwork:if>
                        <webwork:else><img src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow" alt=""><img src="<%= request.getContextPath() %>/images/border/spacer.gif" class="sortArrow" alt=""></webwork:else>
                    </td>
                    <td valign="top" nowrap>
                    	<webwork:if test="./pageName/contains('(Shared)') == false">
	                        <a id="config_<webwork:property value="@status/index" />" href="DashboardConfig!default.jspa?selectPageId=<webwork:property value="./id"/>"><webwork:text name="'configureportalpages.fullconfigure'"/></a>
	                        <webwork:if test="pageName != 'dashboard'">
	                        | <a id="edit_<webwork:property value="@status/index" />" href="EditPortalPage!default.jspa?pageId=<webwork:property value="./id"/>"><webwork:text name="'common.words.edit'"/></a>
	                        | <a id="delete_<webwork:property value="@status/index" />" href="ConfigurePortalPages!delete.jspa?pageId=<webwork:property value="./id"/>"><webwork:text name="'common.words.delete'"/></a>
	                        </webwork:if>
                        </webwork:if>
                    </td>
                </tr>
                </webwork:iterator>
                </table>
            </td></tr>
            </table>

            <br/>
<%
    License license = LicenseManager.getInstance().getLicense(JiraLicenseUtils.JIRA_LICENSE_KEY);
    if (license.isLicenseLevel(EasyList.build(JiraLicenseUtils.JIRA_PROFESSIONAL_LEVEL, JiraLicenseUtils.JIRA_ENTERPRISE_LEVEL)))
    {
%>
            <br/>
            <page:applyDecorator name="jiraform">
                <page:param name="action">ConfigurePortalPages.jspa</page:param>
                <page:param name="submitName"><webwork:text name="'common.forms.add'"/></page:param>
                <page:param name="title"><webwork:text name="'configureportalpages.addpage'"/></page:param>
                <page:param name="width">90%</page:param>
                <ui:textfield label="/text('common.words.name')" name="'addPageName'" size="'30'">
                    <ui:param name="'mandatory'">true</ui:param>
                </ui:textfield>

                <ui:textfield label="/text('common.words.description')" name="'description'" size="'60'" />

                <ui:select label="/text('configureportalpages.startfrom')" name="'copyPageId'" list="dashboardPages" listKey="'id'" listValue="'/pageName(.)'">
                    <ui:param name="'headerrow'"><webwork:text name="'configureportalpages.blankpage'" /></ui:param>
                    <ui:param name="'description'"><webwork:text name="'configureportalpages.blankpage.description'" /></ui:param>
                </ui:select>
            </page:applyDecorator>
<%
    }
%>
            </webwork:if>
        </td></tr>
        </table>
    </td></tr>
    </table>
</body>
</html>